home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-10-13 | 2.4 KB | 53 lines | [TEXT/GEOL] |
- Item 1319256 12-Oct-89 17:56
-
- From: ROSENSTEIN1 Rosenstein, Larry
-
- To: D4071 Aapps, Russ Wetmore,PRT
-
- cc: MACAPP.TECH$ MACAPP Tech
-
- Sub: Re: Re: Changing MacApp Source
-
- Russ,
-
- Your view holder object from ViewEdit is a kind of delegation. You create a
- new class that delegates some of its responsibility to an existing TView
- object. Since Object Pascal doesn't directly support this, you need to write a
- bunch of methods to explicitly do the delegation. Also, the resulting class
- won't be type-compatible with TView (unless, of course it descends from TView
- as well).
-
- Stroustrup proposed adding delegation to C++. You would declare a class as
- descended from a pointer to an object (sort of). The name space of methods
- understood by the new class would include all the methods defined by the static
- type of the pointer. (It doesn't look as if he will actually add this to C++.)
-
- As for the original question of changing the MacApp source, one possibility is
- to simply linking a separatly compiled module into the MacApp library to
- replace a given routine. If you lib together a new object module along with
- MacApp.lib (in that order) then the object file can replace any module in the
- library.
-
- The tricky part is generating the appropriate object module. This requires a
- bit of knowledge about how Object Pascal names things (which is easy to figure
- out.) Then you need to generate a module of the appropriate name. One way to
- do this is as follows.
-
- Suppose you want to replace MacApp's version of TView.Draw. You subclass TView
- and override Draw with your own implementation. Compile the unit. Then use
- the lib tool to rename your overridden module to use TView as the class name.
- The you can lib this with MacApp.lib and replace the old version of TView.Draw.
- It might also be possible to specify the new object module in the make file,
- and have it linked in each time. (That way MacApp.lib does not have to change,
- and you can automatically rebuild the file when needed.)
-
- Since you never changed the sources, there is no problem when a new version of
- MacApp comes out, provided your change is still applicable. If you don't
- change MacApp.lib, then you don't have to do the lib step either.
-
- This won't help if the original MacApp routine accesses some private data, but
- I think in MacApp 2.0 this has been improved.
-
- Larry Rosenstein
-
-